package eleme.openapi.sdk.api.service;

import eleme.openapi.sdk.api.annotation.Service;
import eleme.openapi.sdk.api.base.BaseNopService;
import eleme.openapi.sdk.api.entity.flow.RestaurantEntryFlowStatsReq;
import eleme.openapi.sdk.api.entity.flow.RestaurantEntryFlowStatsResp;
import eleme.openapi.sdk.api.exception.ServiceException;
import eleme.openapi.sdk.config.Config;
import eleme.openapi.sdk.oauth.response.Token;

import java.util.HashMap;
import java.util.Map;

/**
 * 餐厅入口流量服务
 */
@Service("eleme.flow")
public class FlowService extends BaseNopService {
    public FlowService(Config config, Token token) {
        super(config, token, FlowService.class);
    }

    /**
     * 根据时间段获取餐厅流量入口数据
     *
     * @param request 餐厅入口流量查询条件
     * @return 返回查询的餐厅各个入口流量统计的实体||{"statsDatas":[{"restaurantId":11511,"entryModule":"品类入口","title":"美食","exposureNum":"32","pv":12,"uv":11,"gmv":5,"dt":"2018-01-31"}]}
     * @throws ServiceException 服务异常
     */
    public RestaurantEntryFlowStatsResp getEntryFlowStatsData(RestaurantEntryFlowStatsReq request) throws ServiceException {
        Map<String, Object> params = new HashMap<String, Object>();
        params.put("request", request);
        return call("eleme.flow.getEntryFlowStatsData", params);
    }
}
